import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import mitt from 'mitt'
const app = createApp(App)

// 引入文件
import loding from './components/Loding'
app.use(loding) // 编写Vue3插件


const Mit = mitt()

declare module 'vue' {
  export interface ComponentCustomProperties{
    $Bus : typeof Mit,
  }
}

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
app.use(ElementPlus)
app.use(createPinia())
app.use(router)
// 兄弟传值
app.config.globalProperties.$Bus = Mit
// 全局添加数据和方法 每个组件都能用
app.config.globalProperties.$env = 'aaa'
app.config.globalProperties.$fifter = {
  aa(e:any){
    console.log(e); 
  }
}
app.mount('#app')
